<template>
  <div class="header-centainer">
    <div class="l-content">
      <el-button @click="changeMenu" icon="el-icon-menu" size="small" style="margin-right:20px"></el-button>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item v-for="i in mianbao" :key="i.name" :to="{ path: i.path }">{{ i.label }}</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="r-content">
      <el-dropdown @command="loginout">
        <span class="el-dropdown-link">
          <img class="user" src="../assets/52401.png" alt="">
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item>个人中心</el-dropdown-item>
          <el-dropdown-item command="cancel" >退出</el-dropdown-item>

        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import Cookie from 'js-cookie'
export default {
  name: 'common-header',
  data() {
    return {

    }
  },
  methods: {
    changeMenu() {
      this.$store.commit('collapseMenu')
    },
    loginout(command){
      console.log('@@')
      if(command === 'cancel'){
       Cookie.remove('token'),
       Cookie.remove('menu')
       this.$router.push('/login')
      }
    }
  },
  computed:{
    mianbao(){
      return this.$store.state.tab.tabList
    }
  }
}
</script>

<style lang="less" scoped>
.header-centainer {
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #333;
  height: 60px;

  .text {
    color: #fff;
    font-size: 14px;
    margin-left: 14px;
  }
}

.r-content {
  .user {
    width: 40px;
    height: 40px;
    border-radius: 50%;
  }
}
.l-content{
   display: flex;
   align-items: center;
   /deep/.el-breadcrumb__item {
     .el-breadcrumb__inner{
         font-weight: normal;
         &.is-link{
           color:#666
         }
     }
     &:last-child{
       .el-breadcrumb__inner{
          color:#fff;
       }
     }
   }
}
</style>